/*******************************************************
> Copyright (C) 2024 ==iot== All rights reserved.
> File Name: 14.c
> Author: wyf
> Created Time: 2024年09月07日 星期六 15时07分04秒
***************************************************/


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define ARRAY_SIZE 5
int extract_odd_number(const int *arr,int * new_arr,const int length)
{
	int i = 0;
	int j = 0;
	int effective_length = 0;
	while(i < length)
	{
		if(arr[i] % 2 != 0)
		{

			new_arr[j++] = arr[i];
		
		}
		i++;
	}
	effective_length = j;
	return effective_length;
}




int main(int argc, const char* argv[])
{
	int arr[ARRAY_SIZE] = { 0 };
	int new_arr[ARRAY_SIZE] = { 0 };
	int number = 0;
	int length = 0;
	int i = 0;
	for(i = 0;i < ARRAY_SIZE;i++)
	{
		printf("please input a integer : \n");
		scanf("%d",&number);
		arr[i] = number;
	}
	length = i;
	length = extract_odd_number(arr,new_arr,length);

	for(int j = 0;j < length;j++)
	{
		printf("%d",new_arr[j]);

	}

    return 0;

}


